<template>
  <div class="to-top">
    <!--滚动到顶部-->
    <div class="top" @click="top">
      <span class="iconfont iconshuangjiantoushang"></span>
      回到顶部
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    top () {
      document.body.scrollTop = 0
      /* console.log(this.$refs.container)
      console.log(document.documentElement.scrollTop) */
      // this.scroll.scrollToElement(this.$refs.container, 2000)
    }
  }
}
</script>

<style scoped lang="stylus">
  .top
    position: fixed
    bottom: 0px
    right: 0
    width: 70px
    height: 40px
    text-align: center
    background-color: #0ff
    font-size: .24rem
    z-index: 100
    padding: .1rem
    :hover
     color: #f00
   span
     display: block
     margin-bottom: .1rem
</style>
